-
Notifications
You must be signed in to change notification settings - Fork 3.8k
cleos to display pushed actions' return values #9375
Conversation
programs/cleos/main.cpp
Outdated
const auto & iter = at.get_object().find("return_value_data"); | ||
if( iter != at.get_object().end() ) { | ||
return_value = fc::json::to_string(iter->value(), fc::time_point::maximum()); | ||
} else { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wondering if you have to check "return_value_hex_data", too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, "return_value_hex_data"
will always be present(#9354)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if you interact with an older version of nodeos? You need to support older nodeos versions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added a check for return_value_hex_data as well
Change Description
After abi_serializer was updated (#9354) it's time to utilize return values passed by
nodeos
incleos
.cleos
now is capable of displaying the actual return values or their hashes. The new output line starts with=>
followed byreturn value:
/return value (hex):
and the return value.If the
return_value_data
field of returned json is presentcleos
will display it.If
return_value_data
is missing andreturn_value_hex_data
is present cleos will display value ofreturn_value_hex_data
.If
return_value_data
is missing andreturn_value_hex_data
is empty (there is no return value)Example:
or
Change Type
Select ONE
Consensus Changes
API Changes
Documentation Additions
cleos
will have an extra line for actions that return values. The line will be prefixed with=>
. Example actionsrstring()
andruint()
return values passed into them:It can work with structures/classes as well. For a struct like this:
and
rtmp()
returning a default tmp object, output will look like this:When it wont be possible to decode the return value, output will look like this
If length on a return value string is more than 100 chars the string will be truncated to the first 100 chars and
...
will be added at the end. It's similar to whatcleos
does to action parameters output.